#!/bin/bash
project_pid=$(netstat -lnp | grep 7103|awk '{print $7}'|cut -d/ -f1)
echo $project_pid
if [ $project_pid > 0 ];
then
   docker stop renrenuser \
      && docker rm renrenuser \
      && docker rmi renrenuser:1.0 \
      && docker build -f dockerfile -t renrenuser:1.0 . \
      && docker run -p 7103:7103 -v /data/service/RenrenUser/config:/app/config -v /data/service/RenrenUser/logs:/app/logs --name renrenuser -d --privileged --restart always --network dlrs-net renrenuser:1.0
else
   docker build -f dockerfile -t renrenuser:1.0 . \
   && docker run -p 7103:7103 -v /data/service/RenrenUser/config:/app/config -v /data/service/RenrenUser/logs:/app/logs --name renrenuser -d --privileged --restart always --network dlrs-net renrenuser:1.0
fi

